package emulator.unittest.hardware.nmos6502.commands;

import org.junit.Before;
import org.junit.Test;

import emulator.EmulatorException;
import emulator.hardware.nmos6502.Flags6502;
import emulator.hardware.nmos6502.commands.AND;


public class ANDTest extends CommandTestBase {
	@Before
	public void setUp()	{
		command = new AND();
	}
	
	@Test
	public void testAndFull() throws EmulatorException
	{
		for (int i = 0; i < 256; i+=16)
		{
			for (int j = 0; j < 256; j+=8)
			{
				int accu_post = i & j;
				int flags_post = 0;
				if (accu_post == 0)	flags_post |= Flags6502.FLAG_ZERO;
				if (accu_post > 127) flags_post |= Flags6502.FLAG_NEGATIVE;
				executeAndCheckCommandOnAccu(command, 0, i, j, flags_post, accu_post);
			}
		}
	}
}
